<link href="__PUBLIC__/plugins/fitui/tablegrid.css" rel="stylesheet">
<link href="__PUBLIC__/plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet">
<script src="__PUBLIC__/plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js"></script>
<script src="__PUBLIC__/plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="__PUBLIC__/js/mp/format.js"></script>
<script src="__PUBLIC__/plugins/fitui/tablegrid.js"></script>
<script src="__PUBLIC__/js/mp/wx_event_award.js"></script>
<script>
var Param = <?php echo json_encode( $param ) ?> ;
$(function(){
  WxEventAward.init(<?php echo json_encode( $config ) ?>);
});

</script>

<div class="page-content">
  <ol class="breadcrumb">
    <li><a href="<?php echo $home_url ?>">首页</a></li>
    <li><a href="<?php echo U('Mp/MerWxSetting/index') ?>">公众号管理</a></li>
    <li><a href="<?php echo $event_url ?>"><?php echo $event_name ?></a></li>
    <li class="active"><?php echo $module_name ?></li>
  </ol>
  <div class="page-content-inner"> 
    <!-- read_modal -->
    <div class="portlet blue" id="read_modal"> 
      <!-- portlet-title -->
      <div class="portlet-title">
        <div class="caption"> <i class="fa fa-gift "></i> <?php echo $event_name ?> <?php echo $module_name ?> </div>
        <div class="tools">
          <?php if ( $opt_data == 1 || in_array( '添加' , $opt_data ) ) : ?>
          <a href="#" class="toolbtn add load_add_modal_btn" data-toggle="tooltip" data-placement="top" title="新增"></a>
          <?php endif ; ?>
        </div>
      </div>
      <!-- end portlet-title -->
      <div class="portlet-body "> 
        <!-- table grid -->
        <div class="table-responsive">
          <table id="data_table" class="table table-striped table-hover table-condensed">
            <thead>
              <tr>
                <th width="60" data-field="id"  >ID</th>
                <th width="80" data-field="rank" data-formatter="format_rank" >等级</th>
                <th width="180" data-field="name"  >奖品名称</th>
                <th width="80" data-field="total_qty" data-formatter="format_amount" >奖品总数</th>
                <th width="90" data-field="take_rate" data-formatter="format_take_rate">中奖率(%)</th>
                <th width="120" data-field="valid_type" data-formatter="format_valid_type">验证类型</th>
                <th width="100" data-field="valid_start_time">验证起始</th>
                <th width="100" data-field="valid_end_time">验证结束</th>
                <?php if ( $opt_data == 1 || in_array( '兑换码' , $opt_data ) ) : ?>
                <th width="80" data-formatter="opt_award_sn"></th>
                <?php endif ; ?>
                <?php if ( $opt_data == 1 || in_array( '编辑' , $opt_data ) ) : ?>
                <th width="80" data-formatter="opt_edit"></th>
                <?php endif ; ?>
                <?php if ( $opt_data == 1 || in_array( '删除' , $opt_data ) ) : ?>
                <th width="80" data-formatter="opt_delete"></th>
                <?php endif ; ?>
                <th>&nbsp;</th>
              </tr>
            </thead>
          </table>
        </div>
        <!-- end table --> 
        <div class="row" style="text-align:center; margin-top:60px;">
          <button type="button" class="btn btn-lg btn-default" onClick="javascript:history.go(-1)"><i class="fa fa-arrow-left"></i> 返回</button>
        </div>
      </div>
    </div>
    <!-- end portlet read_modal --> 
  </div>
  <!-- end page-content-inner --> 
</div>

<!-- add_edit_model -->
<div class="modal fade" id="add_edit_modal">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="action_label"></h4>
      </div>
      <div class="modal-body">
        <form id="submit_form" class="form-horizontal">
          <div class="form-group">
            <label class="col-sm-3 control-label">奖品名称</label>
            <div class="col-sm-7">
              <input name="name" placeholder="奖品名称" data-valid="required" data-tips="请填写正确的奖品名称" type="text" class="form-control" >
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3 control-label">验证类型</label>
            <div class="col-sm-7">
              <?php echo form_radios( 'valid_type' , $param['valid_type'] ) ?>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3 control-label">验证起始</label>
            <div class="col-sm-7">
              <input name="valid_start_time" placeholder="验证起始时间" type="text" class="form-control dtp" >
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3 control-label">验证结束</label>
            <div class="col-sm-7">
              <input name="valid_end_time" placeholder="验证结束时间" type="text" class="form-control dtp" >
            </div>
          </div>
          <div class="form-group" id="password_line">
            <label class="col-sm-3 control-label">兑换密码</label>
            <div class="col-sm-7">
              <input name="password" placeholder="兑换密码" type="text" class="form-control" >
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3 control-label">等级</label>
            <div class="col-sm-7">
              <select name="rank" class="form-control" >
                <?php echo form_options($param['rank']) ?>
              </select>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3 control-label">奖品总数</label>
            <div class="col-sm-7">
              <input name="total_qty" placeholder="奖品总数" data-valid="num" data-tips="请填写正确的奖品总数" type="text" class="form-control" >
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3 control-label">中奖率</label>
            <div class="col-sm-3">
              <div class="input-group">
                <input name="take_rate" type="text" class="form-control" placeholder="中奖率" aria-describedby="basic-addon2">
                <span class="input-group-addon" id="basic-addon2">%</span>
              </div>
            </div>
            <div class="col-sm-4">
              填0表示不用中奖率<br>值：10 , 22 , 50 , 80
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3 control-label">领取数</label>
            <div class="col-sm-7">
              <input name="taken_qty" placeholder="领取数(不填)"  type="text" class="form-control" >
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3 control-label">剩余数</label>
            <div class="col-sm-7">
              <input name="remain_qty" placeholder="领取数(不填)"  type="text" class="form-control" >
            </div>
          </div>

        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-times"></i> 关闭</button>
        <button type="button" class="btn btn-primary" id="submit_btn"><i class="fa fa-check"></i> 提交</button>
      </div>
    </div>
    <!-- /.modal-content --> 
  </div>
  <!-- /.modal-dialog --> 
</div>
<!-- /#add_edit_model --> 

